<?php

/**
 * Enqueue scripts and styles for front-end.
 *
 * @since Acoem 1.0
 *
 * @return void
 */
function acoem_scripts_styles() {
	global $wp_styles;
	
	if ( is_admin() ) {
		wp_register_style( 'acoem_admin_css', get_template_directory_uri() . '/css/admin.css' );
		wp_enqueue_style( 'acoem_admin_css' );
	}else{
		wp_deregister_script( 'jquery' );
		wp_register_script( 'jquery', get_template_directory_uri() . '/js/jquery.min.js', array(), null, in_footer );
		
		wp_enqueue_script( 'acoem-bootstrap', 'http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js', array(), '1.3.2', true );
		
	
		/*
		 * Adds JavaScript to pages with the comment form to support
		 * sites with threaded comments (when in use).
		 */
		if ( is_singular() && comments_open() && get_option( 'thread_comments' ) )
			wp_enqueue_script( 'comment-reply' );

		// Adds JavaScript for handling the navigation menu hide-and-show behavior.
		wp_enqueue_script( 'acoem-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '1.0', true );

		$font_url = acoem_get_font_url();
		if ( ! empty( $font_url ) )
			wp_enqueue_style( 'acoem-fonts', esc_url_raw( $font_url ), array(), null );

		// Loads our main stylesheet.
		wp_enqueue_style( 'acoem-style', get_stylesheet_uri() );

		// Loads the Internet Explorer specific stylesheet.
		wp_enqueue_style( 'acoem-ie', get_template_directory_uri() . '/css/ie.css', array( 'acoem-style' ), '20121010' );
		$wp_styles->add_data( 'acoem-ie', 'conditional', 'lt IE 9' );
		
		wp_register_style( 'acoem_bootstrap_css', get_template_directory_uri() . '/css/bootstrap.min.css' );
		wp_enqueue_style( 'acoem_bootstrap_css' );
		
		wp_register_style( 'acoem_bootstrap_responsive_css', get_template_directory_uri() . '/css/bootstrap-responsive.min.css' );
		wp_enqueue_style( 'acoem_bootstrap_responsive_css' );
		
		wp_register_style( 'acoem_layout_css', get_template_directory_uri() . '/css/layout.css' );
		wp_enqueue_style(acoem_layout_css);
		
		
		wp_enqueue_script( 'acoem-bootstrap', get_template_directory_uri() . '/js/bootstrap.min.js', array(), '1.0', true );
		
		wp_enqueue_script( 'acoem-custom', get_template_directory_uri() . '/js/custom.js', array(), '1.0', true );
	}
	
	
}
add_action( 'init', 'acoem_scripts_styles' );


/**
 * Register sidebars.
 *
 * Registers our main widget area and the front page widget areas.
 *
 * @since Acoem 1.0
 */
function acoem_widgets_init() {
	register_sidebar( array(
		'name' => __( 'Main Sidebar', 'acoem' ),
		'id' => 'sidebar-1',
		'description' => __( 'Appears on posts and pages except the optional Front Page template, which has its own widgets', 'acoem' ),
		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
		'after_widget' => '</aside>',
		'before_title' => '<h3 class="widget-title">',
		'after_title' => '</h3>',
	) );

	register_sidebar( array(
		'name' => __( 'First Front Page Widget Area', 'acoem' ),
		'id' => 'sidebar-2',
		'description' => __( 'Appears when using the optional Front Page template with a page set as Static Front Page', 'acoem' ),
		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
		'after_widget' => '</aside>',
		'before_title' => '<h3 class="widget-title">',
		'after_title' => '</h3>',
	) );

	register_sidebar( array(
		'name' => __( 'Second Front Page Widget Area', 'acoem' ),
		'id' => 'sidebar-3',
		'description' => __( 'Appears when using the optional Front Page template with a page set as Static Front Page', 'acoem' ),
		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
		'after_widget' => '</aside>',
		'before_title' => '<h3 class="widget-title">',
		'after_title' => '</h3>',
	) );
}
add_action( 'widgets_init', 'acoem_widgets_init' );


function acoemplugin_add_button($buttons){
    array_push($buttons, "separator", "acoemplugin");
    return $buttons;
}
 
function acoemplugin_register($plugin_array){    
    $url= get_bloginfo('template_url')."/js/editor.js";
 
    $plugin_array["acoemplugin"] = $url;
    return $plugin_array;
}


add_filter('mce_external_plugins', "acoemplugin_register");
add_filter('mce_buttons', 'acoemplugin_add_button', 0);

?>